package com.hd.assistant.biz.util;

import java.util.HashMap;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;


public class TestOpenApiV3 {

	public static void main(String args[]) {

		String appOAuthID = "";
		String appOAuthkey = "";
		String accessToken = "";
		long uin = 1;
      
	 //---------------IDC-----1280863473----------
      appOAuthID = "700136169";
      appOAuthkey = "acD85sAvmoNI9OwL";
      accessToken = "bd799258a803b0bfff16e6d5b09fd5f2";
      uin = 171004886;
      
		
		PaiPaiOpenApiOauth sdk = null;
		sdk = new PaiPaiOpenApiOauth(appOAuthID, appOAuthkey, accessToken, uin);
//		sdk = PaiPaiOpenApiOauth.initial("C:\\apitest\\214689727_idc.properties");
		
//		sdk.setMethod("post");
		sdk.setCharset("gbk");
		sdk.setFormat("json");
		HashMap<String, Object> params = sdk.getParams("/user/getUserInfo.xhtml");
		// 填充URL请求参数
//		params.put("categoryIds", "100419,104919,101773,105063,101311,101307,101493,101309,101313,101315,101774,100391,100291,100540,100302,101685,100322,100324,100330,100336,100340,100489,101328,101324,101500,101497,101494,101316,101330,100482,100484,104786,100298,101326,100372,101333,101320,101329,100368,101331,100440,100529,100538,100445,100424,100425,100548,100550,100553,100564,100570,100477,100526,100447,100449,100466,100462,100505,100504,100460,100513,100453,100516,100451,100455,100520,100470,100486,100474,100493,100305,100384,100413,100405,100376,100378,100382,100310,100320,100380,100374,100338,100435,100353,100589,100289,101513,100355,101549,100296,100318,100509,100349,100501,100498,100481,100491,101884,100488,101879,100511,100347,100345,100544,100546,100294,100555,100557,100563,100292,100574,100542,100308,100343,100341,100328,100523,100317,100528,100531,100536,100572,100403,100409,100422,100364,100420,100465,100370,100360,100417,100415,100362,100458,100430,100428,100395,100432,100475,100401,100393,100389,100357,100369,100396,100300,100433,100568,100443,100517,100386,100534,100561,100438,100399,100312,100495,100468,100315,100407,100532,100329,100307,100503,100335,100507,101321,101325,101332,101334,101496,104783,101491,101498,101318,104785,101322,101308,101327,104784,101310,101323,101319,101312,101314,101495,101772,101770,101775,101771,100293,100354,100457,100512,100499,100387,100514,100452,100518,100519,100450,100363,100510,100461,100494,100478,100476,100483,100485,100487,100454,100406,100358,100390,100490,100492,100383,100448,100590,100375,100352,100437,100366,100371,100537,100543,100414,100558,100554,100545,100479,100541,100525,100446,100381,100527,100379,100530,100377,100442,100566,100567,100334,100326,100342,100344,100346,100348,100337,100313,100309,100351,100327,100316,100304,100303,100365,100361,100392,100359,100394,100373,100356,100367,100388,100412,100533,100535,100560,100539,100434,100416,100551,100547,100421,100573,100431,100429,100426,100569,100524,100411,100469,100496,100400,100497,100402,100464,100500,100502,100408,100463,100508,100521,100522,100565,100385,100397,100404,100410");
//		params.put("", "855006089");
//		params.put("pageSize", "30");
//		params.put("tms_op", "admin@855006089");
//		params.put("tms_opuin", ""+uin);
//		params.put("tms_skey", "@WXOgdqq16");
		params.put("userUin", "445393912");
		params.put("zhongwen", "中文");
//		accessToken=c59a360748d61bf9bcc31a4fd3113481
//		&appOAuthID=700030739
//		&categoryIds=100419,104919,101773,105063,101311,101307,101493,101309,101313,101315,101774,100391,100291,100540,100302,101685,100322,100324,100330,100336,100340,100489,101328,101324,101500,101497,101494,101316,101330,100482,100484,104786,100298,101326,100372,101333,101320,101329,100368,101331,100440,100529,100538,100445,100424,100425,100548,100550,100553,100564,100570,100477,100526,100447,100449,100466,100462,100505,100504,100460,100513,100453,100516,100451,100455,100520,100470,100486,100474,100493,100305,100384,100413,100405,100376,100378,100382,100310,100320,100380,100374,100338,100435,100353,100589,100289,101513,100355,101549,100296,100318,100509,100349,100501,100498,100481,100491,101884,100488,101879,100511,100347,100345,100544,100546,100294,100555,100557,100563,100292,100574,100542,100308,100343,100341,100328,100523,100317,100528,100531,100536,100572,100403,100409,100422,100364,100420,100465,100370,100360,100417,100415,100362,100458,100430,100428,100395,100432,100475,100401,100393,100389,100357,100369,100396,100300,100433,100568,100443,100517,100386,100534,100561,100438,100399,100312,100495,100468,100315,100407,100532,100329,100307,100503,100335,100507,101321,101325,101332,101334,101496,104783,101491,101498,101318,104785,101322,101308,101327,104784,101310,101323,101319,101312,101314,101495,101772,101770,101775,101771,100293,100354,100457,100512,100499,100387,100514,100452,100518,100519,100450,100363,100510,100461,100494,100478,100476,100483,100485,100487,100454,100406,100358,100390,100490,100492,100383,100448,100590,100375,100352,100437,100366,100371,100537,100543,100414,100558,100554,100545,100479,100541,100525,100446,100381,100527,100379,100530,100377,100442,100566,100567,100334,100326,100342,100344,100346,100348,100337,100313,100309,100351,100327,100316,100304,100303,100365,100361,100392,100359,100394,100373,100356,100367,100388,100412,100533,100535,100560,100539,100434,100416,100551,100547,100421,100573,100431,100429,100426,100569,100524,100411,100469,100496,100400,100497,100402,100464,100500,100502,100408,100463,100508,100521,100522,100565,100385,100397,100404,100410
//		&charset=gbk
//		&cooperatorId=855006089
//		&pageSize=30
//		&randomValue=12312
//		&source=TMS
//		&timeStamp=1344474000
//		&tms_op=admin@855006089
//		&tms_opuin=2552600101
//		&tms_skey=@WXOgdqq16
//		&uin=2552600101 
		
		
//		sdk.setHostName("10.6.223.106:9000");//dev wanggou
//		sdk.setHostName("apitest.buy.qq.com");
		
		try {
			String resp = sdk.invoke();
			
			//JSONObject jsonObj =sdk.invokeJson();
			System.out.println("\n\n------------接口调用结果-------------\n\n"+resp);
			
		} catch (OpenApiException e) {
			System.out.printf("Request Failed. code:%d, msg:%s\n", e.getErrorCode(), e.getMessage());
			e.printStackTrace();
		}
		
	}

}
